#define DEBUG
#include <cstdio>
#include <cstring>
#define MAXN 100
#define MAXL 100
#define MAXS 200

using namespace std;

bool solve(int x, char fench[][MAXL+2], int n, int l, char s[], int sn, int ans[]) {
  static int f[MAXL+1][MAXS+1];
  memset(f, 0, sizeof(f));
  for (int i=1; i<=l; i++) {
    for (int j=1; j<=sn; j++) {
      if (!f[i][j]) {
	for (int k=1; k<=n; k++) {
	  bool flag=true;
	  for (int m=j, p=i; flag && m<=sn; m+=x, p++){
	    flag = p<=l && fench[k][p]==s[m];
	  } 
	  if (flag) {
	    for (int m=j, p=i; m<=sn; m+=x, p++) {
	      f[p][m]=k;
	    }
	    break;
	  }
	}
      }
    }
  }
  
  for (int i=1; i<=l; i++) {
    for (int j=1; j<=x; j++) {
      bool flag=true;
      for (int k=1; flag && k<j; k++) {
	flag = flag && f[i+1][x-j+1+k];
	ans[k] = f[i+1][x-j+1+k];
      }
      for (int k=j; flag && k<=x; k++) {
	flag = flag && f[i][k-j+1];
	ans[k] = f[i][k-j+1];
      }
      if (flag) {
	return true;
      }
    }
  }
  return false;
}

int main() {
#ifdef DEBUG
  freopen("3159.in", "r", stdin);
  freopen("3159.out", "w", stdout);
#endif

  static char fench[MAXN+1][MAXL+2], s[MAXS+2];
  int n, l;
  scanf("%d %d", &n, &l);
  for (int i=1; i<=n; i++) {
    scanf("%s", fench[i]+1);
  }
  scanf("%s", s+1);
  int sn=strlen(s+1);

  bool flag=false;
  static int ans[MAXS+1];
  for (int i=1; i<=sn; i++) {
    if (solve(i, fench, n, l, s, sn, ans)) {
      printf("%d\n", i);
      for (int j=1; j<=i; j++) {
	printf("%d ", ans[j]);
      }
      flag = true;
      break;
    }
  }
  if (!flag) {
    printf("-1");
  }

  fcloseall();
  return 0;
}
